<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="../assets/images/favicon.ico">
    <title>壹脉智能CRM</title>
    <!-- Bootstrap Core CSS -->
    <link href="./css/bootstrap.min.css" rel="stylesheet">
    <!-- <link href="../assets/node_modules/perfect-scrollbar/css/perfect-scrollbar.css" rel="stylesheet"> -->

    <!-- <link href="../assets/node_modules/sweetalert/sweetalert.css" rel="stylesheet" type="text/css"> -->


    <!-- This page CSS -->
    <!-- chartist CSS -->
    <!-- <link href="../assets/node_modules/morrisjs/morris.css" rel="stylesheet"> -->
    <!--c3 CSS -->
    <!-- <link href="../assets/node_modules/c3-master/c3.min.css" rel="stylesheet"> -->
    <!--Toaster Popup message CSS -->
    <!-- <link href="../assets/node_modules/toast-master/css/jquery.toast.css" rel="stylesheet"> -->
    <!-- Custom CSS -->
    <link href="css/style.min.css" rel="stylesheet">
    <!-- Dashboard 1 Page CSS -->
    <!--<link href="css/pages/dashboard1.css" rel="stylesheet">-->
    <!-- You can change the theme colors from here -->
    <link href="css/colors/default.css" id="theme" rel="stylesheet">
    <link rel="stylesheet" href="css/diy.min.css">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body class="fix-header fix-sidebar card-no-border">
<div class="preloader">
    <div class="loader">
        <div class="loader__figure"></div>
        <p class="loader__label">壹脉</p>
    </div>
</div>
<div id="main-wrapper">
    <header class="topbar">
        <nav class="navbar top-navbar navbar-expand-md navbar-light">
            <div class="navbar-header">
                <a class="navbar-brand" href="../index.html">
                    <b>
                        <img src="../assets/images/diy/yimai.png" alt="homepage" class="dark-logo"/>
                        <!--<img src="../assets/images/logo-light-icon.png" alt="homepage" class="light-logo"/>-->
                    </b>
                    <span>
                        <span class="fs18 cblue p-l-6 fbold">壹脉智能CRM</span>
                    </span>
                </a>
            </div>
            <div class="navbar-collapse">
                <ul class="navbar-nav mr-auto">
                    <li class="nav-item"> <a class="nav-link nav-toggler hidden-md-up waves-effect waves-dark" href="javascript:void(0)"><i class="sl-icon-menu"></i></a> </li>
                    <li class="nav-item"> <a class="nav-link sidebartoggler hidden-sm-down waves-effect waves-dark" href="javascript:void(0)"><i class="sl-icon-menu"></i></a> </li>
                </ul>
                <user-head></user-head>
            </div>
        </nav>
    </header>
    <aside class="left-sidebar">
        <div class="scroll-sidebar">
            <company-position></company-position>
            <nav class="sidebar-nav p-0">
                <c-slider current="5"></c-slider>
            </nav>
        </div>
    </aside>
    <div class="page-wrapper">

        <div class="container-fluid">

            <div class="row page-titles">
                <div class="col-md-5 align-self-center">
                    <h3 class="text-themecolor">企业管理</h3>
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="javascript:void(0)">HOME</a></li>
                        <li class="breadcrumb-item active">企业信息</li>
                    </ol>
                </div>
            </div>

            <!--form-->
            <div class="row">
                <div class="col-lg-12">
                    <div class="card">
                        <div class="card-body">
                            <form action="#">
                                <div class="form-body col-md-6">
                                    <div class="d-flex m-b-19">
                                        <span class="control-label required col-3">
                                            企业LOGO
                                        </span>
                                        <label class="w120 h120 bradius4 textc bced m-0 position-relative ohidden goods-img"
                                               :class="clientForm.companyLogo ? '' :'icon-plus'"
                                               :style="'background-image: url('+clientForm.companyLogo+')'">
                                            <input type="file" id="file" name="image_url" style="float: left;display: none" @change="upLoadLogo" />
                                        </label>

                                    </div>
                                    <div class="d-flex align-cen m-b-19">
                                        <span class="control-label required col-3">
                                            企业名称
                                        </span>
                                        <input type="text" id="name" class="form-control phgray" v-model="clientForm.companyName" placeholder="企业名称">
                                    </div>
                                    <div class="d-flex align-cen m-b-19">
                                        <span class="control-label required col-3">
                                            所属行业
                                        </span>
                                        <select type="text" id="industry" class="form-control phgray" v-model="clientForm.industryId" placeholder="所属行业">
                                            <option v-for="item in industryList" :value="item.industryId" :key="item.industryId">
                                                {{item.industryName}}
                                            </option>
                                        </select>
                                    </div>

                                    <div class="d-flex align-cen m-b-19">
                                        <span class="control-label required col-3">
                                            企业密令
                                        </span>
                                        <input type="text" id="password" class="form-control phgray" v-model="clientForm.password" placeholder="员工申请加入企业的密令">
                                    </div>

                                    <div class="d-flex m-b-19">
                                        <span class="control-label col-3">
                                            企业公告
                                        </span>
                                        <textarea type="text" id="notice" class="form-control phgray h120" v-model="clientForm.companyNotice" placeholder="企业公告" maxlength="200"></textarea>
                                    </div>

                                    <div class="d-flex">
                                        <span class="w85 textc btn-success cfff bradius4 curpointer lh40" :class="{disabled: loading}" @click="saveChange">保存</span>
                                    </div>


                                </div>

                            </form>
                        </div>
                    </div>
                </div>
            </div>


        </div>

    </div>

    </div>

</div>
<!-- All Jquery -->
<!-- ============================================================== -->
<script src="js/jquery.min.js"></script>
<!-- Bootstrap popper Core JavaScript -->
<!-- <script src="../assets/node_modules/bootstrap/js/popper.min.js"></script> -->
<script src="js/bootstrap.min.js"></script>
<!-- slimscrollbar scrollbar JavaScript -->
<!-- <script src="js/perfect-scrollbar.jquery.min.js"></script> -->
<!--Wave Effects -->
<!-- <script src="js/waves.js"></script> -->
<!--Menu sidebar -->
 <script src="js/sidebarmenu.js"></script>
<!--Custom JavaScript -->
<script src="js/custom.min.js"></script>
<!-- ============================================================== -->
<!-- This page plugins -->
<!-- ============================================================== -->
<!--morris JavaScript -->
<!-- <script src="../assets/node_modules/raphael/raphael-min.js"></script>
<script src="../assets/node_modules/morrisjs/morris.min.js"></script> -->
<!--c3 JavaScript -->
<!--<script src="../assets/node_modules/d3/d3.min.js"></script>-->
<!--<script src="../assets/node_modules/c3-master/c3.min.js"></script>-->
<!-- Popup message jquery -->
<!-- <script src="../assets/node_modules/toast-master/js/jquery.toast.js"></script> -->

<!-- <script src="../assets/node_modules/sweetalert/sweetalert.min.js"></script>
<script src="../assets/node_modules/sweetalert/jquery.sweet-alert.custom.js"></script> -->

<!-- Chart JS -->
<!--<script src="js/dashboard1.js"></script>-->
<!-- ============================================================== -->
<!-- Style switcher -->
<!-- ============================================================== -->
<!-- <script src="../assets/node_modules/styleswitcher/jQuery.style.switcher.js"></script> -->
<script src="js/layer/layer.js"></script>
<script src="js/vue.js"></script>
<script src="js/config.js"></script><script src="js/extend.js"></script>
<!--<script src="js/headers.js"></script>-->
<!--<script src="js/Aside.js"></script>-->

<script>
    $(function () {
        var vw = new Vue({
            el: '#main-wrapper',
            // components:{header},
            data: {
                clientForm: {
                    companyName:'',
                    companyNotice: '',
                    industryId: 0,
                    companyLogo: '',
                    password: '',
                },
                industryList: [],
                loading: false,
            },
            mounted(){
                this.getCompanyInfo();
                this.getIndustryList();
            },
            methods:{
                getCompanyInfo() {
                    $.cAjax('/crmPc/companyGoods/getCompany', {

                    }).then(res=>{
                        this.clientForm = res;
                    })
                },
                getIndustryList(){
                    $.cAjax('/crmPc/companyGoods/getList', {
                        type: 'GET',
                    }).then(res=>{
                        this.industryList = res;
                    })
                },
                saveChange(){
                    if(this.loading) return;

                    this.loading = true;
                    $.cAjax('/crmPc/companyGoods/updCompany', {
                        data: this.clientForm,
                    }).then(res=>{
                        layer.alert('修改成功!');
                        this.loading=false;
                    }).catch(res=>{
                        this.loading=false;
                    })
                },
                upLoadLogo: function () {
                    var v = this;
                    var f = document.getElementById('file');
                    if(f.files[0].type!='image/png'&&f.files[0].type!='image/jpeg'&&f.files[0].type!='image/jpg'){
                        layer.alert("请选择png、jpg、jpeg格式的图片");
                        return
                    }
                    if(f.files[0].size/1024>1024*2){
                        layer.alert('请上传小于2M的图片！');
                        return
                    }

                    let formData = new FormData;
                    formData.append('file', f.files[0]);

                    $.uploadFile(formData).then(res=>{
                        f.value = '';
                        this.clientForm.companyLogo  = $.baseFileUrl + '/' + res.data
                    });

                },
            },

        })
    })
</script>

</body>

</html>












